﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Data.SQLite;
using Com.Toook.Common;

public partial class nst_ShowPageParamAdd : BasePage
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void ButtonAdd_Click(object sender, EventArgs e)
    {
        string sql = "insert into ShowPageParam(typeId, typeCode, typeName, typeTotalCount, title, keyword, description, newsSiteId, remark) " +
            " values(@typeId, @typeCode, @typeName, @typeTotalCount, @title, @keyword, @description, @newsSiteId, @remark)";
        SQLiteConnection con = SqliteHelper.GetConnection("SQLiteDatabase");
        SQLiteCommand cmd = new SQLiteCommand(sql, con);
        cmd.Parameters.Add("@typeId", DbType.Int32).Value = txtTypeId.Text;
        cmd.Parameters.Add("@typeCode", DbType.AnsiString, 20).Value = txtTypeCode.Text;
        cmd.Parameters.Add("@typeName", DbType.String, 20).Value = txtTypeName.Text;
        cmd.Parameters.Add("@typeTotalCount", DbType.Int32).Value = txtTypeTotalCount.Text;
        cmd.Parameters.Add("@title", DbType.String, 30).Value = txtTitle.Text;
        cmd.Parameters.Add("@keyword", DbType.String, 50).Value = txtKeyword.Text;
        cmd.Parameters.Add("@description", DbType.String, 80).Value = txtDescription.Text;
        cmd.Parameters.Add("@newsSiteId", DbType.AnsiString, 100).Value = txtNewsSiteId.Text;
        cmd.Parameters.Add("@remark", DbType.String, 50).Value = txtRemark.Text;

        try
        {
            con.Open();
            cmd.ExecuteNonQuery();
            LabelMsg.Text = "添加成功";
            txtTypeId.Text = "";
        }
        catch(Exception ex)
        {
            LogHelper.Log.Error(ex);
        }
        finally
        {
            SqliteHelper.CloseDbResource(con, null);
        }
    }
}
